<!DOCTYPE html>
<html>

<!-- Mirrored from www.zi-han.net/theme/hplus/table_jqgrid.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:02 GMT -->
<!--保购个性化配置页面  -->

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>保购个性化配置页面</title>

    <link href="css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="css/animate.min.css" rel="stylesheet">
    <link href="css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link href="css/timePicker.css" rel="stylesheet">
    <link href="css/newStyle.css" rel="stylesheet">
    <link href="js/plugins/fancybox/jquery.fancybox.css" rel="stylesheet">

    <style>
        /* 重写bookstrap样式表 勿删 */
        .form_inputs {
            width: 160px;
            background-color: #ebebeb;
            border: 1px solid #06a3f9;
            border-radius: 20px;
            -webkit-border-radius: 20px;
            -moz-border-radius: 20px;
            -o-border-radius: 20px;
            -ms-border-radius: 20px;
        }

        .ibox-title {
            padding: 20px;
        }

        .mb30 {
            margin-bottom: 20px;
        }

        /* 重写bookstrap样式表 勿删 */
        .ui-jqdialog {
            height: auto !important;
        }

        .ui-common-table tbody {
            background-color: #eaf5fc !important;
        }

        .modal-dialog {
            margin: 80px auto !important;
        }

        .form-group {
            margin-left: 0px !important;
            margin-right: 0px !important;
        }

        .modal-sm {
            width: 600px;
        }

        .col-sm-3 {
            width: 30%;
        }

        .col-sm-8 {
            width: 70%;
        }

        .form-horizontal .control-label {
            text-align: left;
            padding-top: 5px;
            font-size: 18px;
        }

        @media only screen and (min-width: 100px) and (max-width: 600px) {
            .modal-sm {
                width: 400px;
            }

            .col-sm-3 {
                width: 40%;
            }

            .col-sm-8 {
                width: 60%;
            }

            .scroll_div {
                width: 85%;
            }

            .form-horizontal .control-label {
                text-align: left;
                padding-top: 5px;
                font-size: 14px;
            }

            .dialog_btn {
                font-size: 14px !important;
            }
        }

        @media only screen and (min-width: 650px) {
            .modal-sm {
                width: 600px;
            }
        }

        /*以下是等待状态的通用样式*/
        .wating_big_div {
            position: fixed;
            top: 0px;
            width: 100%;
            height: 100%;
            display: table;
            z-index: 9999;
        }

        .zhezhao {
            opacity: 0.3;
            position: absolute;
            top: 0px;
            width: 100%;
            height: 100%;
            z-index: 9999;
        }

        .wating_content_div {
            text-align: center;
            background: none;
            display: table-cell;
            vertical-align: middle;
        }

        /*以上是等待状态的通用样式*/
        .inputcherckStyle {
            width: 18px;
            height: 18px;
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
            background: url("")
        }

        .inputcherckStyle:hover {
            background: url("")
        }

        .inputcherckStyle:checked {
            background: url("")
        }

        #timebox {
            width: 50%;
            height: 100%;
            /* display: flex;
        align-items: center; */
        }

        #timebox>span {
            width: 4.16%;
            display: block;
            float: left;
        }

        .title_choose {
            padding: 5px 10px;
            font-size: 14px;
            margin-right: 10px;
            margin-top: 8px;
            margin-bottom: 5px;
            border: 1px solid #ccc;
            text-align: center;
            cursor: pointer;
        }

        .nonetext {
            width: 100%;
            height: 40px;
            line-height: 40px;
            text-align: center;
            display: none;
        }

        /* 物流 */
        .logistics_content {
            text-align: center;
            min-height: 200px;
        }

        .logistics_li {
            position: relative;
            padding: 0px 0 20px 25px;
            line-height: 18px;
            border-left: 1px solid #A6ABAF;
            color: #999;
        }

        .logistics_li .logistics_icona {
            display: block;
            position: absolute;
            left: -7px;
            top: 0;
            width: 15px;
            height: 15px;
            z-index: 9;
        }

        .logistics_li .logistics_iconb {
            display: block;
            position: absolute;
            left: -5px;
            top: 0;
            width: 10px;
            height: 10px;
            z-index: 9;
        }

        .logistics_text {
            color: #999999;
            font-size: 12px;
            text-align: left;
            margin-bottom: 10px;
        }

        .logistics_time {
            color: #CCCCCC;
            font-size: 12px;
            text-align: left;
        }

        .input_height {
            height: 34px;
            border: 1px solid #ccc;
        }

        .form-horizontal .control-label {
            font-size: 16px !important;
        }

        .add_btn {
            position: absolute;
            right: 20px;
            top: -10px;
            background: #16d585;
            height: 35px;
            width: 80px;
            color: #fff;
            border-radius: 5px;
            font-size: 15px;
        }

        .onoffswitch {
            margin: 0 auto !important;
        }

        .clear_btn_style {
            margin-top: 30px;
        }

        #add_btn {
            background-color: #16d585;
        }
        .input_if {
            margin-left: 10px;
        }
    </style>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content  animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox ">

                    <div class="ibox-title pull-left w100p" style="padding: 10px 20px;">
                        <div class="pull-left">
                            <div class="ibox-tools cache5">
                                保购个性化配置
                            </div>
                        </div>

                        <div class="pull-right">
                            <button class="refresh_btn">
                                <a class="refresh_a">
                                    <i class="fa fa-refresh"></i> 刷新
                                </a>
                            </button>
                        </div>
                    </div>

                    <div class="ibox-content pull-left w100p jqGrid_wrapper" id="uploadedWrap" data-gridtype="0"
                        style="padding-top: 0px;">
                        <div class="w100p chaxunBorder">
                            <div class="ibox-title w100p"
                                style="height:50px;background-color: rgb(243, 243, 243);padding: 10px 20px;border-top:0px;">
                                <div class="ibox-tools pull-left">
                                    <span class="titleFindIcon pull-left"></span>
                                    <span class="pull-left" style="position: relative;top: 3px;left: 5px;">筛选条件</span>
                                </div>
                                <!-- 查询按钮 -->
                                <div class="pull-right ml30">
                                    <button class="opera_btn" id="check_btn">查询</button>
                                </div>
                            </div>
                            <!-- 搜索条件 -->
                            <div class="w100p p20" style="display: flex;">


                                <!--保购账号 -->
                                <div class="ml30">
                                    <span class="f14 pull-left h30 lh30">保购账号：</span>
                                    <div class="pull-left input_if">
                                        <input type="text" class="form-control h30 w100p backList" style="width: 150px;"
                                            id="check_arg2_input" placeholder="账号" aria-required="true">
                                    </div>
                                </div>

                                <div class="ml30">
                                    <span class="f14 pull-left h30 lh30">保购姓名：</span>
                                    <div class="pull-left input_if">
                                        <input type="text" class="form-control h30 w100p backList" style="width: 150px;"
                                            id="check_arg2_input" placeholder="用户昵称" aria-required="true">
                                    </div>
                                </div>
                                <!-- 注册时间 -->
                                <div class="ml30">
                                    <span class="f14 pull-left h30 lh30">注册时间：</span>
                                    <div class="pull-left input_if">
                                        <!-- 开始时间 -->
                                        <input type="text"
                                            class="layui-input form-control h30 w100p form-control h30 w100p startTime"
                                            autocomplete="off" id="chooseTim" placeholder="请选择日期" name="createTime"
                                            style="padding-left: 5px;">
                                    </div>
                                </div>

                            </div>
                            <!-- 添加按钮 -->
                            <div style="position: relative;width: 100%;height: 30px;">
                                <button class="opera_btn add_btn" data-toggle="modal"
                                    data-target="#add_dialog">添加</button>
                            </div>
                        </div>


                        <div class="ibox-title pull-left w100p table-head"
                            style="background-color: rgb(243, 243, 243);padding: 10px 20px;border-top:0px;">
                            <div class="pull-left">
                                <div class="ibox-tools" style="">
                                    <span class="titleFontIcon"></span>
                                    <span class="pull-left" style="position: relative;top: 3px;left: 5px;">数据列表</span>
                                </div>
                            </div>
                        </div>
                        <!-- 列表标题 -->
                        <div class="pull-left w100p">
                            <table class="table table-bordered mb0 ">
                                <thead>
                                    <tr>
                                        <th><input name="Fruit" class="w20 h20 header_checkbox" type="checkbox"
                                                value="" /></th>
                                        <th>保购账号</th>
                                        <th>保购昵称</th>
                                        <th>真实姓名</th>
                                        <th>保购星级</th>
                                        <th>联系方式</th>
                                        <th>支付宝账号</th>
                                        <th>粉丝数</th>
                                        <th>作品数量</th>
                                        <th>账户启用状态</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody id="tbody_list1"></tbody>
                            </table>
                            <div class="nonetext">暂无数据</div>
                        </div>
                        <div class="pull-left tac c0 f14 w100p pre mt10" id="footer_page_div">
                            <div class="">
                                <div class="pull-left">
                                    <div class="ibox-tools">
                                        <a class="refresh_a">
                                            <i class="fa fa-refresh"></i> 刷新
                                        </a>
                                    </div>
                                </div>
                                <!-- 操作分页 -->
                                <span class="under_line cursor_pointer f_last_span">上一页</span>
                                <span class="pl20 f_page_span">1</span>
                                <span class="pl20 under_line cursor_pointer f_next_span">下一页</span>
                                <span class="pl20">共 <span class="f_count_page_span">1</span> 页</span>
                                <div class="disib ml20">
                                    每页显示：
                                    <select class="p0 disib f_page_select">
                                        <option value="" selected="selected">10</option>
                                        <option value="">20</option>
                                        <option value="">30</option>
                                    </select>
                                    条
                                </div>
                            </div>
                            <div class="record_right_div">

                                数据库总数量： <span class="f_counts_span">0</span> 条
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>




    <!--保购个性配置添加-->
    <div class="modal inmodal fade" id="add_dialog" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content br8">
                <div class="modal-header p10 bdno">
                    <button type="button" class="close" data-dismiss="modal"><span
                            aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <span class="modal-title f18">添加保购员</span>
                </div>
                <div class="modal-body bg_f p0">
                    <div class="ibox-content p30">
                        <!-- 标题搜索 -->
                        <div style="display: flex;">
                            <div class="modal_input">
                                <div class="input-group">
                                    <input type="text" class="form-control title_input" placeholder="保购昵称"
                                        style="width: 200px;">
                                    <span class="input-group-btn queryButton">
                                        <button class="btn btn-default title_btn" type="button"><span
                                                class="glyphicon glyphicon-search"></span></button>
                                    </span>
                                </div>
                            </div>

                            <!-- 备注搜索 -->
                            <div class="modal_input" style="margin-left: 50px;">
                                <div class="input-group">
                                    <input type="text" class="form-control remark_input" placeholder="手机号码"
                                        style="width: 200px;">
                                    <span class="input-group-btn queryButton">
                                        <button class="btn btn-default remark_btn" type="button"><span
                                                class="glyphicon glyphicon-search"></span></button>
                                    </span>
                                </div>
                            </div>
                        </div>
                        <!-- 消息模板列表 -->
                        <div class="modal_list" style="margin-top: 20px;">
                            <div class="pull-left w100p">
                                <table class="table table-bordered mb0 ">
                                    <thead>
                                        <tr>
                                            <th><input name="Fruit" class="w20 h20 header_checkbox1" type="checkbox"
                                                    value="" /></th>
                                            <th>保购员账号</th>
                                            <th>保购昵称</th>
                                            <th>真实姓名</th>
                                            <th>保购星级</th>
                                            <th>联系方式</th>
                                            <th>支付宝账号</th>
                                            <th>粉丝数</th>
                                            <th>作品数量</th>
                                        </tr>
                                    </thead>
                                    <tbody id="tbody_list2">
                                    </tbody>
                                </table>
                            </div>
                            <div class="pull-left tac c0 f14 w100p pre mt10" id="footer_page_div1">
                                <div class="">
                                    <!-- 操作分页 -->
                                    <span class="under_line cursor_pointer f_last_span1">上一页</span>
                                    <span class="pl20 f_page_span1">1</span>
                                    <span class="pl20 under_line cursor_pointer f_next_span1">下一页</span>
                                    <span class="pl20">共 <span class="f_count_page_span1">1</span> 页</span>
                                    <div class="disib ml20">
                                        每页显示：
                                        <select class="p0 disib f_page_select1">
                                            <option value="" selected="selected">8</option>
                                            <option value="">12</option>
                                            <option value="">15</option>
                                        </select>
                                        条
                                    </div>
                                </div>
                                <div class="record_right_div1">
                                    数据库总数量： <span class="f_counts_span1">0</span> 条
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer bdno tac pt0040">
                    <button type="button" class=" btn-white clear_btn_style dialog_btn" data-dismiss="modal">取消</button>
                    <button type="button" class=" btn-primary clear_btn_style bdno dialog_btn ml30"
                        id="add_btn">添加</button>
                </div>
            </div>
        </div>
    </div>



    <script src="js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
    <script src="./lib/layui/layui.js" charset="utf-8"></script>
    <script src="js/bootstrap.min.js?v=3.3.6"></script>
    <script src="js/plugins/peity/jquery.peity.min.js"></script>
    <script src="js/content.min.js?v=1.0.0"></script>
    <script src="js/plugins/layer/laydate/laydate.js"></script>
    <script src="js/plugins/sweetalert/sweetalert.min.js"></script>
    <script src="js/plugins/iCheck/icheck.min.js"></script>
    <script src="js/plugins/fancybox/jquery.fancybox.js"></script>
    <script src="js/common.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/jquery-timepicker.js" type="text/javascript" charset="utf-8"></script>
    <!--ajax上传插件:jquery.form ajaxSubmit-->
    <script src="js/jquery-form.js" type="text/javascript" charset="utf-8"></script>
    <script>
        layui.use(['layedit', 'laydate'],
            function () {
                var table = layui.table,
                    layer = layui.layer,
                    layedit = layui.layedit,
                    laydate = layui.laydate;
                laydate.render({
                    elem: '#chooseTim',//搜索时间框
                });
            });

        var tableTimeout, addTimeout, setPowerTime, editManageTimeout, deleteTimeOut, getPowerTime,
            limits = 10,
            page = 1,
            counts = 0
        var maxIndex;  //最多多少页
        //添加的列表
        var limits1 = 8,
            page1 = 1,
            counts1 = 0
        var maxIndex1;

        var userMessage;
        var backList, back_id//查询的参数

        $(document).ready(function () {
            IsTokenSave();
            userMessage = JSON.parse(sessionStorage.getItem("user_message"));

            $(".refresh_a").click(function () { //刷新按钮
                location.reload();
            });

            InitTbodyList(page);  //初始化列表数据
            InitTbodyList1(page);  //新增的初始化列表

            $("#check_btn").click(function () { //查询按钮
                backList = $('.backList').val();
                page = 1; //重置页数
                $(".f_page_span").html(1); //重置页数
                $("#tbody_list1").html('');
                $(".nonetext").hide();
                InitTbodyList(page); //获取列表数据
            });


            //分页部分的操作(大列表)
            $(".f_page_select").change(function () { //选择一页多少条数据的select
                page = 1; //重置页数
                $(".f_page_span").html(1); //重置页数
                limits = $(".f_page_select option:selected").text(); //设置当前显示数量
                InitTbodyList(page);
            });

            $(".f_last_span").click(function () { //上一页
                if (page < 2) {
                    TipsAlert("这是最前面的数据了");
                    return false;
                }
                page--;
                $(".f_page_span").html(parseInt($(".f_page_span").html()) - 1);
                InitTbodyList(page);
            });
            $(".f_next_span").click(function () { //下一页
                if (page > maxIndex - 1) {
                    TipsAlert("这是最后面的数据了");
                    return false;
                }
                page++;
                $(".f_page_span").html(parseInt($(".f_page_span").html()) + 1);
                InitTbodyList(page);
            });


            //分页部分的操作(新填列表)
            $(".f_page_select1").change(function () { //选择一页多少条数据的select
                page1 = 1; //重置页数
                $(".f_page_span1").html(1); //重置页数
                limits1 = $(".f_page_select1 option:selected").text(); //设置当前显示数量
                InitTbodyList1(page1);
            });

            $(".f_last_span1").click(function () { //上一页
                if (page1 < 2) {
                    TipsAlert("这是最前面的数据了");
                    return false;
                }


                page1--;
                $(".f_page_span1").html(parseInt($(".f_page_span1").html()) - 1);
                InitTbodyList1(page1);
            });
            $(".f_next_span1").click(function () { //下一页
                if (page1 > maxIndex1 - 1) {
                    TipsAlert("这是最后面的数据了");
                    return false;
                }
                page1++;
                $(".f_page_span1").html(parseInt($(".f_page_span1").html()) + 1);
                InitTbodyList1(page1);
            });


            // 全选  取消全选（大列表）
            $(".header_checkbox").change(function () {
                var thisStatus = $(".header_checkbox").is(':checked');
                // console.log(thisStatus)
                if (thisStatus) {
                    $("#tbody_list1 .td_checkbox").prop('checked', true)
                } else {
                    $("#tbody_list1 .td_checkbox").removeAttr("checked");
                }
            });
            //单选框操作
            $("#tbody_list1").on('change', '.td_checkbox', function () {
                var $subs = $("#tbody_list1 input");
                $(".header_checkbox").prop("checked", $subs.length == $subs.filter(":checked").length ? true : false);
            });

            // 全选  取消全选（新增的框）
            $(".header_checkbox1").change(function () {
                var thisStatus = $(".header_checkbox1").is(':checked');
                // console.log(thisStatus)
                if (thisStatus) {
                    $("#tbody_list2 input").prop('checked', true)
                } else {
                    $("#tbody_list2 input").removeAttr("checked");
                }
            });
            //单选框操作
            $("#tbody_list2").on('change', '.td_checkbox1', function () {
                var $subs = $("#tbody_list2 input");
                $(".header_checkbox1").prop("checked", $subs.length == $subs.filter(":checked").length ? true : false);
            });


            $("#add_btn").click(function () {   //添加的保存按钮
                var guide_list = []
                if ($('.td_checkbox1:checkbox:checked').length > 0) {
                    $.each($('.td_checkbox1:checkbox:checked'), function () {
                        guide_list.push($(this).val())
                    })
                    console.log(guide_list.join(','))
                    if (guide_list.length > 0) {
                        swal({
                            title: "添加保购成功",
                            type: "success",
                        });
                        // window.location.href = './orderDelivery.html?id=' + order_serial_list.join(',')
                    } else {
                        TipsAlert("请选择需要添加的保购");
                    }
                } else {
                    TipsAlert("请在列表左侧勾选需要添加的保购");
                }

                //     $.ajax({
                //         type: "post",
                //         url: urls + 'technologyService/addIP',
                //         async: true,
                //         timeout: 30000,
                //         dataType: "json",
                //         headers: {
                //             'X-Access-Token': userMessage.token,
                //         },
                //         data: {
                //             ip: $('.ip_address').val(),
                //             caseIP: $('.reason').val(),
                //             excuType: reason_code
                //         },
                //         success: function (json) {
                //             CheckLogout(json);//检查是否登陆过期
                //             if (json.code == 0) {
                //                 swal({
                //                     title: "添加成功",
                //                     text: "添加成功",
                //                     type: "success",
                //                 }, function () {
                //                     location.reload();
                //                 });
                //             } else {
                //                 TipsAlert(json.msg);
                //             }
                //             InitTime(addTimeout);
                //         },
                //         error: function (xml, text, errorThrown) {
                //             if (text == "timeout") {
                //                 TipsAlert("请求超时,请检查网络或着重新打开该页面.");
                //             } else {
                //                 TipsAlert("请求数据失败,请联系后台技术人员");
                //             }
                //             InitTime(addTimeout);
                //         }
                //     });
            });
        })
        /**
         * 该方法用于初始化列表
         * @param {Number} startIndex startIndex是数据起始下标
         * */
        Showload();
        function InitTbodyList(startIndex) {
            tableTimeout = setInterval("Timeout(tableTimeout)", 1000);
            var tableHtml = "";
            $.ajax({
                type: "get",
                url: urls + 'technologyService/selectIPLog',
                async: true,
                timeout: 30000,
                dataType: "json",
                headers: {
                    'X-Access-Token': userMessage.token,
                },
                data: {
                    page: startIndex,
                    limit: limits,
                    ip: backList
                },
                success: function (res) {
                    CheckLogout(res); //检查是否登陆过期
                    if (res.code == 0) {
                        var myData = res.data.records;
                        counts = res.data.total;
                        if (counts == 0) { //显示或隐藏分页
                            $("#footer_page_div").hide();
                            $(".nonetext").show();
                            InitTime(tableTimeout);
                            return
                        } else {
                            $("#footer_page_div").show();
                        }
                        maxIndex = (counts / limits).toCeil(0);
                        $(".f_count_page_span").html(maxIndex); //设置当前共几页  
                        $(".f_counts_span").html(counts);

                        for (var i = 0; i < myData.length; i++) {
                            var no_code;
                            if (myData[i].operation_state == 1) {
                                no_code = '发短信'
                                myData[i]["checked"] = "checked";
                            } else if (myData[i].operation_state == 2) {
                                no_code = '登入'
                                myData[i]["checked"] = "";
                            } else {
                                no_code = '发短信 , 登入'
                                myData[i]["checked"] = "";
                            }

                            tableHtml += '<tr>' +
                                '<td><input type="checkbox" name="" data-index="' + i + '"  class="w20 h20 td_checkbox" value="' + myData[i].create_time + '" /></td>' +
                                '<td data-ip=' + myData[i].ipAddress + ' data-id="' + myData[i].id + '" data-cause="' + myData[i].cause + '" data-code="' + myData[i].operation_state + '">' + myData[i]["ipAddress"] + '</td>' +
                                '<td class="c_1ABC9C">' + myData[i]["cause"] + '</td>' +
                                '<td>' + no_code + '</td>' +
                                '<td>' + myData[i]["create_time"] + '</td>' +
                                '<td>' + myData[i]["create_time"] + '</td>' +
                                '<td>' + myData[i]["create_time"] + '</td>' +
                                '<td>' + myData[i]["create_time"] + '</td>' +
                                '<td>' + myData[i]["create_time"] + '</td>' +
                                '<td>' +
                                '<div class="onoffswitch" style="height:30px;"><input ' + myData[i]["checked"] + ' type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="TJmyonoffswitch' + i + '"><label class="TJswitchBtn switchBtn" for="TJmyonoffswitch' + i + '" data-index="' + i + '"><span class="onoffswitch-inner"></span><span class="onoffswitch-switch"></span></label></div></div></td>' +
                                '<td>' +
                                '<span class="under_line cursor_pointer edit_span  c_1ABC9C" data-toggle="modal" data-target="#edit_dialog" style="margin-right:20px;">编辑</span>'
                                + '<span class="under_line cursor_pointer delete_span c_1ABC9C" >删除</span>'
                            '</td>' +
                                '</tr>';
                        }
                        $("#tbody_list1").html(tableHtml);
                        DealTable();
                        InitFunc();

                    } else {
                        TipsAlert(json.code);
                    }
                    InitTime(tableTimeout);
                },
                error: function (xml, text, errorThrown) {
                    if (text == "timeout") {
                        TipsAlert("请求超时,请检查网络或着重新打开该页面.");
                    } else {
                        TipsAlert("请求数据失败,请联系后台技术人员");
                    }
                    InitTime(tableTimeout);
                }
            });
        }

        // 选择保购的列表
        function InitTbodyList1(startIndex) {
            var tableHtml1 = "";
            $.ajax({
                type: "get",
                url: urls + 'sales/getSalesList',
                async: true,
                timeout: 30000,
                dataType: "json",
                headers: {
                    'X-Access-Token': userMessage.token,
                },
                data: {
                    page: startIndex,
                    limit: limits1,
                },
                success: function (res) {
                    CheckLogout(res); //检查是否登陆过期
                    if (res.code == 0) {
                        var myData = res.data.records;
                        counts1 = res.data.total;
                        if (counts1 == 0) { //显示或隐藏分页
                            $("#footer_page_div1").hide();
                            $(".nonetext1").show();
                            InitTime(tableTimeout);
                            return
                        } else {
                            $("#footer_page_div1").show();
                        }
                        maxIndex1 = (counts1 / limits1).toCeil(0);
                        $(".f_count_page_span1").html(maxIndex1); //设置当前共几页  
                        $(".f_counts_span1").html(counts1);

                        for (var i = 0; i < myData.length; i++) {
                            tableHtml1 += '<tr>' +
                                '<td><input type="checkbox" name="" data-ip="' + myData[i].ipAddress + '" class="w20 h20 td_checkbox1" value="' + myData[i].alipay_name + '" /></td>' +
                                '<td>' + myData[i]["account_phone"] + '</td>' +
                                '<td class="c_1ABC9C">' + myData[i]["nickname"] + '</td>' +
                                '<td >' + myData[i]["alipay_name"] + '</td>' +
                                '<td>' + myData[i]["status"] + '</td>' +
                                '<td>' + myData[i]["phone"] + '</td>' +
                                '<td>' + myData[i]["alipay_account"] + '</td>' +
                                '<td>' + myData[i]["alipay_account"] + '</td>' +
                                '<td>' + myData[i]["alipay_account"] + '</td>' +
                                '</tr>';
                        }
                        $("#tbody_list2").html(tableHtml1);
                    } else {
                        TipsAlert(json.code);
                    }
                },
                error: function (xml, text, errorThrown) {
                    if (text == "timeout") {
                        TipsAlert("请求超时,请检查网络或着重新打开该页面.");
                    } else {
                        TipsAlert("请求数据失败,请联系后台技术人员");
                    }
                    InitTime();
                }
            });
        }

        /**
         * 该方法用于初始化操作列里的事件
         * */
        function InitFunc() {
            //账户启用状态开关操作
            $('.TJswitchBtn').each(function () {
                $(this).on('click', function () {
                    var index = $(this)[0].dataset.index  //拿到当前索引
                    // console.log(index)
                    var switch_code = $('#TJmyonoffswitch' + index).prop('checked');  //当前开关状态
                    if (switch_code == true) {
                        $.ajax({
                            type: 'post',
                            url: urls + 'sales/antiRefuse',
                            headers: {
                                'X-Access-Token': JSON.stringify(sessionStorage.getItem("user_message")).token,
                            },
                            data: {
                                id: 120
                            },
                            success: function (res) {
                                if (res.code == 0) {
                                    swal({
                                        title: "账户已关闭",
                                        type: "success",
                                    });
                                }else{
                                    TipsAlert("操作失败,请联系后台技术人员");
                                }
                            }
                        })
                    } else {
                        $.ajax({
                            type: 'post',
                            url: urls + 'sales/antiPass',
                            headers: {
                                'X-Access-Token': JSON.stringify(sessionStorage.getItem("user_message")).token,
                            },
                            data: {
                                id: 120
                            },
                            success: function (res) {
                                if (res.code == 0) {
                                    swal({
                                        title: "账户已启用",
                                        type: "success",
                                    });
                                }else{
                                    TipsAlert("操作失败,请联系后台技术人员");
                                }
                            }
                        })
                    }
                })
            })


            $(".edit_span").each(function () {    //编辑数据回写
                $(this).click(function () {
                    var dataset = $(this).parents("td").siblings("td").eq(0)[0].dataset;

                    window.location.href = 'guide_operatingSet.html'
                });
            });

            $(".delete_span").each(function () { //删除按钮
                $(this).click(function () {
                    var dataset = $(this).parents("td").siblings("td").eq(0)[0].dataset;
                    // console.log(JSON.parse(sessionStorage.getItem("user_message")));
                    var userMessage = JSON.parse(sessionStorage.getItem("user_message"));
                    swal({
                        title: "请再次确认是否删除？",
                        text: "删除后将无法恢复，请谨慎操作！",
                        type: "warning",
                        showCancelButton: true,
                        confirmButtonColor: "#DD6B55",
                        confirmButtonText: "是的，确定删除",
                        cancelButtonText: "让我再考虑一下…",
                        closeOnConfirm: false,
                        closeOnCancel: true
                    }, function (yes) {
                        if (yes) {
                            Showload("正在请求删除，请稍后....");
                            deleteTimeOut = setInterval("Timeout(deleteTimeOut)", 1000);
                            $.ajax({
                                type: "post",
                                url: urls + 'technologyService/deleteIP',
                                async: true,
                                timeout: 30000,
                                dataType: "json",
                                headers: {
                                    'X-Access-Token': userMessage.token,
                                },
                                data: {
                                    id: dataset.id,
                                    ipType: 2
                                },
                                success: function (json) {
                                    // console.log(json);
                                    CheckLogout(json);
                                    if (json.code == 0) {
                                        swal({
                                            title: "删除成功",
                                            text: "删除成功",
                                            type: "success",
                                        }, function () {
                                            location.reload();
                                        });
                                    }
                                    InitTime(deleteTimeOut);
                                },
                                error: function (xml, text, e) {
                                    if (text == "timeout") {
                                        TipsAlert("请求超时,请检查网络或着重新操作");
                                    } else {
                                        TipsAlert("请求数据失败,请联系后台技术人员");
                                    }
                                    InitTime(deleteTimeOut);
                                }
                            });
                        }
                    });

                });
            }); //编辑按钮结束括号
        }
    </script>

</body>

</html>